Anti-Spoofing

ABSTRACT

A method of configuring an anti-spoofing system to detect if a spoofing attack has been attempted, in which an image processing component of the anti-spoofing system is trained to process 2D verification images according to a set of image processing parameters, in order to extract depth information from the 2D verification images. The configured anti-spoofing system comprises an anti-spoofing component which uses an output from the processing of a 2D verification image by the image processing component to determine whether an entity captured in that image corresponds to an actual human or a spoofing entity.

TECHNICAL FIELD

This disclosure relates to anti-spoofing, i.e. technology for distinguishing between an actual human and a spoofing entity masquerading as such.

BACKGROUND

In the context of device security and the like, a spoofing attack refers to a technique whereby an unauthorised entity attempts to “spoof” a system in order to gain illegitimate access to a restricted function.

A particular class of spoofing occurs in contexts where image-based face authentication or other image-based verification processes are used. In such cases, a user may attempt to spoof the system using a pre-captured photograph or image of another user, which may be presented on either paper or a digital device such as a phone screen In this context, anti-spoofing refers to techniques of detecting whether an entity, which may exhibit what are ostensibly human characteristics, is actually a real, living being or is a non-living entity masquerading as such (spoofing entity). This may also be referred to as liveness detection. Such techniques have, for example, been implemented in modern mobile devices (such as smartphones) to provide anti-spoofing in the context of biometric authentication.

Anti-spoofing can be based on 3D structure detection in which a spoofing entity is detected based on discrepancies between the 3D structure of the spoofing entity and an actual human. This is particularly effective for detecting 2D spoofing entities such as a photograph or video of a person on a display. This can make use of 3D image capture equipment. For example, some modern smart phones include 3D depth detection technology on infra-red projection to provide facial verification with anti-spoofing safeguards. Other techniques look for the presence of 3D structures in 2D images during intervals of relative motion between an image capture device and an entity being verified. These do not require 3D imaging equipment, but generally do require a user to perform a predetermined motion to capture the necessary motion effects.

SUMMARY

Certain embodiments of the present invention allow anti-spoofing to be performed based on depth information extracted from 2D (two-dimensional) image data using machine learning (ML) processing, such as convolutional neural network (CNN) processing. The anti-spoofing can be performed without the use of 3D image capture equipment and without the user necessarily having to perform specified motion as part of the test.

One aspect of the present invention relates to a method of configuring an anti-spoofing system to detect if a spoofing attack has been attempted, the method comprising: training an image processing component of the anti-spoofing system to process 2D verification images according to a set of image processing parameters, in order to extract depth information from the 2D verification images; and wherein the configured anti-spoofing system comprises an anti-spoofing component which uses an output from the processing of a 2D verification image by the image processing component to determine whether an entity captured in that image corresponds to an actual human or a spoofing entity; wherein the image processing parameters are learned during the training from a training set of captured 3D training images of both actual humans and spoofing entities, each 3D training image captured using 3D image capture equipment and comprising 2D image data and corresponding depth data, by: processing the 2D image data of each 3D training image according to the image processing parameters, so as to compute an image processing output for comparison with the corresponding depth data of that 3D image, and adapting the image processing parameters in order to match the image processing outputs to the corresponding depth data, thereby training the image processing component to extract depth information from 2D verification images captured using a 2D image capture device.

A classification component of the anti-spoofing component may be configured to classify each of the 2D verification images, in relation to real and spoofing classes, respectively, to 2D verification images of actual humans and 2D verification images of spoofing entities, using the output from the processing of that image by the image processing component, for use in making said determination.

The 2D verification image may be a facial image.

The image processing parameters may be adapted to match the image processing outputs to the corresponding depth data based on a loss function, which provides a measure of difference between each of the image processing outputs and the corresponding depth data.

The loss function may be a relative depth loss function which provides a measure of difference between a relative depth order of different image points predicted in each image processing output and a relative depth of those features in the corresponding depth data, without penalizing discrepancies in the absolute depth of those features when their relative depth has been predicted correctly.

The image processing component may comprise a plurality of neural network processing layers. The neural network processing layers may comprise convolutional neural network (CNN) processing layers.

The classification component of the anti-spoofing system may classify images according to a set of classification parameters, which are learned from example 2D verification images labelled with anti-spoofing classification labels.

The example 2D verification images may be 2D components of the 3D training images.

The image processing component may be trained in a pre-training phase, and the classification component may be subsequently trained to learn the classification parameters in a fine-tuning phase.

The learned image processing parameters may be frozen in the fine-tuning phase. Alternatively, small changes may be permitted to tune the parameters based on the classification error.

The classification component may comprise at least one neural network processing layer. The neural network processing layer of the classification component may be fully connected.

The anti-spoofing system may comprise a feature processing component which refines the output prior to classification based on a set of learned feature processing parameters.

The feature processing parameters may be learned in the fine-tuning phase simultaneously with the classification parameters.

The output used to make said determination may comprise the extracted depth information.

The output used to make said determination may comprise an output of at least one hidden layer of the image processing component.

The training may be based on a regression loss function, which penalises deviations between the image processing outputs and the corresponding depth data, each image processing output in the form of an estimated depth map and the depth data of each 3D training image being in the form of a ground truth depth map.

The training may be based on an ordinal regression loss function, defined with respect to a set of depth classes in the manner that encodes a relative ordering of the depth classes, wherein the depth data of each 3D training image is used to derive ground truth depth classification data for each image, to which the image processing outputs are matched in training.

The anti-spoofing system may further comprise at least one patch-based anti-spoofing classifier, which classifies each of multiple image patches within an inputted 2D image in relation to real and spoofing classes, wherein the patch-based anti-spoofing classifier is trained such that different image patches of the inputted 2D image may be differently classified in relation to those classes, wherein the patch-based anti-spoofing classifier is trained using at least one of: the 2D image data of the 3D training images, and a separate set of 2D verification training images.

The anti-spoofing system may use the combination of classification by the classification component of the 2D verification image and the classifications of the patches within that 2D verification image by the patch-based anti-spoofing classifier in order to determine whether the entity is an actual human or a spoofing entity.

The patch-based anti-spoofing classifier may have a convolutional neural network (CNN) architecture, wherein each image patch is defined by a configuration of convolutional filtering layers within the CNN architecture, the configuration of the convolutional filtering layers such that the image patches are overlapping.

A second aspect of the present invention relates to a computer system for performing anti-spoofing based on 2D verification images, the computer system comprising: an image input configured to receive a 2D verification image captured by a 2D image capture device; a machine learning image processing component configured to extract depth information from the 2D verification image according to a set of learned image processing parameters, the image processing parameters having been learned from 3D training images captured using 3D image capture equipment; and an anti-spoofing component configured to use the extracted depth information to determine whether an entity captured in the 2D verification image corresponds to an actual human or a spoofing entity.

The anti-spoofing component may comprise a classification component configured to use the extracted depth information to classify the 2D verification image in relation to real and spoofing classes corresponding, respectively, to 2D verification images of actual humans and 2D verification images of spoofing entities for making said determination.

The computer system may comprise an illumination controller configured to generate a control output to cause an illumination component to illuminate a field of view of the image capture device whilst the 2D verification image is captured, wherein the depth information is extracted based on resulting illumination effects captured in the 2D verification image.

The illumination effects may comprise at least one of glare and shadow effects.

The computer system may comprise an access controller configured to regulate access to a restricted function based said determination by the anti-spoofing component.

The 2D verification image may be a static image. The 2D verification image may be a video image comprising a sequence of video frames.

The image processing component may comprise a plurality of CNN layers.

The anti-spoofing component may further comprise at least one patch-based anti-spoofing classifier, which separately classifies each of multiple image patches within the 2D verification image in relation to real and spoofing classes whereby different image patches may be classified differently in relation to those classes, and wherein the anti-spoofing component uses the extracted depth information together with the classifications of the multiple image patches by the patch-based anti-spoofing classifier to determine whether the entity is an actual human or a spoofing entity.

The anti-spoofing component may use the combination of the classification of the 2D verification image by the classification component together with the classifications of the image patches to make said determination.

The anti-spoofing component is configured o assign an anti-spoofing score to each pixel of at least some pixels of the 2D verification image, by determining a subset of the image patches containing that pixel, and assigning the anti-spoofing score to the pixel based on local classification scores assigned to the subset of image patches by the patch-based anti-spoofing classifier.

The anti-spoofing score may be computed as an average of the local classification scores assigned to the subset of image patches.

The patch-based anti-spoofing classifier may have a convolutional neural network (CNN) architecture, wherein each of the multiple image patches is defined by a configuration of convolutional filtering layers within the CNN architecture, and the configuration of the convolutional filtering layers is such that the image patches are overlapping.

The at least one patch-based anti-spoofing classifier may comprise: a first patch based anti-spoofing classifier, trained to distinguish between images of actual human faces and images of a first type of spoofing attack; a second patch-based anti-spoofing classifier, trained to distinguish between images of actual human faces and images of a second type of spoofing attack, the second type of spoofing attack different tat the first type of spoofing attack.

The first type of anti-spoofing attack may include mask and/or cut-out attacks, and the second type of spoofing attack may include print and/or replay attacks.

It should be understood that the terminology “classifying in relation to real and anti-spoofing classes” does not necessarily imply a binary classification (the classification may or may not be binary), but more generally implies a classification task where at least one class corresponds to real humans and at least one corresponds to spoofing entity. For example, the classification task may be defined over multiple classes corresponding to different types of spoofing entity/attack. Conceptually, these may be considered “sub-classes” of a broader anti-spoofing class corresponding to spoofing attacks generally, and the terminology “classifying in relation to real and anti-spoofing classes” encompasses a multi-classification task which is explicitly formulated over sub-classes of one or both of those broader classes.

For example, as an alternative to providing first and second patch-based anti-spoofing classifiers, a single patch-based classifier may be explicitly defined over at least three classes: one real class, a second spoofing sub-class corresponding to a first type of attack (e.g. cut-out/mask), and a third spoofing sub-class correspond to a second type of attack (e.g. print/replay).

A third aspect of the present invention relates to an anti-spoofing system comprising a depth estimation component configured to receive a 2D verification image captured by a 2D image capture device and to extract estimated depth information therefrom; a global anti-spoofing classifier configured to use the extracted depth information to classify the 2D verification image in relation to real and spoofing classes corresponding, respectively, to 2D verification images of actual humans and 2D verification images of spoofing entities, and thereby assign a global classification value to the whole of the 2D verification image; and a patch-based anti-spoofing classifier configured to classify each image patch of multiple image patches of the 2D verification image in relation to the real and anti-spoofing classes, and thereby assign a local classification value to each image patch of the multiple image patches; wherein the anti-spoofing system is configured to use the global and local classification values to determine whether an entity captured in the 2D verification image corresponds to an actual human or a spoofing entity.

The depth estimation component may be a machine learning component which has been trained using 3D images captured using 3D imaging equipment.

The anti-spoofing system may comprise a second patch-based anti-spoofing classifier configured to classify each image patch of multiple image patches of the 2D verification image in relation to the real and anti-spoofing classes, and thereby assign a second local classification value to each image patch of the multiple image patches; wherein first patch-based anti-spoofing classifier is configured to distinguish between images of actual human faces and images of a first type of spoofing attack, and the second patch-based anti-spoofing classifier is configured to distinguish between images of actual human faces and images of a second type of spoofing attack, the second type of spoofing attack different than the first type of spoofing attack.

The first type of spoofing attack may include mask and/or cut-out attacks, and the second type of spoofing attack may include print/and/or replay attacks.

A fourth aspect of the present invention relates to a patch-based anti-spoofing classifier embodied in a computer system and comprising a series of convolutional filtering layers, a first of which is configured to receive a 2D verification image and apply convolutional filtering thereto, wherein subsequent filtering layers of the series are configured to apply convolutional filtering to the outputs of previous convolutional filtering layers of the series; a classification layer configured to compute local classification values for respective image patches within the 2D verification image, based on the convolutional filtering by the convolutional filtering layers, wherein each image patch is defined by a configuration of the convolutional filtering layers, wherein each local classification value classifies each image patch in relation to real and anti-spoofing classes corresponding, respectively, to 2D verification images of actual humans and spoofing entities.

The convolutional layers may apply filters with respective strides and respective perceptive fields, wherein each mage patch has a size dependent on the perceptive fields, and the number of image patches is dependent on the strides and the size of the 2D verification image.

A fifth aspect of the present invention relates to a computer program product comprising computer readable instructions stored on a non-transitory computer readable storage medium and which, when executed, is configured to implement a method comprising: training an image processing component of the anti-spoofing system to process 2D verification images according to a set of image processing parameters, in order to extract depth information from the 2D verification images; and wherein the configured anti-spoofing system comprises an anti-spoofing component which uses an output from the processing of a 2D verification image by the image processing component to determine whether an entity captured in that image corresponds to an actual human or a spoofing entity; wherein the image processing parameters are learned during the training from a training set of captured 3D training images of both actual humans and spoofing entities, each 3D training image comprising 2D image data and corresponding depth data, by: processing the 2D image data of each 3D training image according to the image processing parameters, so as to compute an image processing output for comparison with the corresponding depth data of that 3D image; and adapting the image processing parameters in order to match the image processing outputs to the corresponding depth data, thereby training the image processing component to extract depth information from 2D verification images.

By training the image processing component using the disclosed method, it can learn to infer depth information from 2D images. The depth knowledge can then be used by the anti-spoofing system to determine if the 2D verification image is of an actual human or a spoofing entity based on the differences between their inferred depth characteristics.

Certain embodiments of the invention are particularly effective in combatting spoofing attacks using 2D spoofing entities such as photographs or videos but is effective in any context in which a spoofing entity exhibits differing depth characteristics to an actual human which can be inferred from a 2D verification image.

Another aspect of the invention provides a method of configuring an anti-spoofing system to detect if a spoofing attack has been attempted, the method comprising: training an image processing component of the anti-spoofing system to process 2D verification images according to a set of image processing parameters, in order to extract depth information from the 2D verification images; and wherein the configured anti-spoofing system comprises an anti-spoofing component which uses an output from the processing of a 2D verification image by the image processing component to determine whether an entity captured in that image corresponds to an actual human or a spoofing entity; wherein the image processing parameters are learned during the training from a training set of captured 3D training images of both actual humans and spoofing entities, each 3D training image comprising 2D image data and corresponding depth data, by: processing the 2D image data of each 3D training image according to the image processing parameters, so as to compute an image processing output for comparison with the corresponding depth data of that 3D image, and adapting the image processing parameters in order to match the image processing outputs to the corresponding depth data, thereby training the image processing component to extract depth information from 2D verification images.

A further aspect of the invention provides a computer system for performing anti-spoofing based on 2D verification images, the computer system comprising: an image input configured to receive a 2D verification image captured by an image capture device; a machine learning image processing component configured to extract depth information from the 2D verification image according to a set of learned image processing parameters, the image processing parameters having been learned from 3D training images; and an anti-spoofing component configured to use the extracted depth information to determine whether an entity captured in the 2D verification image corresponds to an actual human or a spoofing entity.

BRIEF DESCRIPTION

For better understanding of the present invention, and to show how embodiments of the same may be carried into effect, reference is made to the following figures in which:

FIG. 1 shows a schematic block diagram of a computer system in which anti-spoofing is implemented;

FIG. 2 shows a schematic functional block diagram of an access control system;

FIG. 3 shows a functional block diagram of a trained anti-spoofing system;

FIGS. 4A and 4B illustrate how training data may be collected;

FIG. 5 shows an example of image depth data;

FIG. 6 shows how a Convolutional Neural Network (CNN) can be trained to predict the depth of pixels in a 2D image;

FIG. 7 shows how a classifier can be trained to classify a 2D image as of an actual human or a spoofing entity;

FIG. 8 shows a functional block diagram of an anti-spoofing classifier;

FIG. 9 illustrates high level principles of data processing operations performed within a convolutional neural network;

FIG. 9a schematically illustrates the relationship between a set of convolutional filtering layers in a CNN and an image patch within an original image;

FIG. 10 shows a schematic block diagram of an ordinal regression architecture;

FIG. 11 shows an example of a localized, patch-based anti-spoofing component;

FIG. 12 shows an example of an anti-spoofing system with a global depth estimator and two separately-trained patch-based anti-spoofing components; and

FIG. 13 shows a spoofing “heatmap” overlaid on an image from which it is derived.

DETAILED DESCRIPTION OF THE DRAWINGS

Embodiments of the present invention will now be described by way of example only.

FIG. 1 shows a highly schematic block diagram of a computer system 150 comprising a computer device 102 at which a user 100 may be verified. The computer device 102 may, for example, a user device, for example, a smart phone, tablet, personal computer etc. In the following, the computer device 102 is referred to as a user device although the relevant description applies to any computer device. The user device 102 comprises an image capture device 106 (camera) which can be used to capture images of the user 100 of the device 102.

Such image data is used as a basis for anti-spoofing, which requires the user 100 to allow at least one 2D image of himself (verification image) to be captured by the image capturing device 106. An anti-spoofing check is performed to verify that it is indeed an actual human in the verification image, as opposed to a photograph, or video (played back on a mobile device, for example) of a human, or other spoofing entity that may have human characteristics.

The user device 102 is shown to further comprise at least one processor 108 such as a CPU (central processing unit). The CPU may be configured to execute at least one restricted function, to which access by the user 100 is restricted subject, at least in part, to anti-spoofing checks. Examples include, for example, functions that provide access to secure data or any other secure functionality to which access is regulated. Alternatively, these restricted functions may be accessed and executed remotely, for example, on remote server 116.

The user device 102 also comprises a user interface (UI) 104 via which user inputs may be received from the user 100 and information may be outputted to the user 100. The UI 104 may, for example, comprise any suitable combination of input and output devices, such as a display and associated touch screen. Other input devices such as keyboards or mice may be used by the user 100, along with one or more output devices such as a display. Although shown as a separate component, the image capture device 106 may be considered part of the UI 104 for example where gesture inputs are provided via the image capture device 106.

The user device 102 is shown to also comprise a memory 110 in which computer programs are stored for execution on the processor 108, along with any associated data.

The user device 102 also comprises a network interface 112 via which the user device 102 can connect to a network 114, such as the Internet. The user device 102 is able to connect, via the network 114, to a back-end system comprising at least one remote server 116. The back-end system forms part of the computer system 150. The remote server comprises a processor 120 for executing computer programs. It also comprises a memory 118 in which computer programs are stored for execution on the processor 120 along with any associated data. The computer programs may, for example, have restricted features which the user 100 needs to be verified to access.

FIG. 2 shows a functional block diagram of an example of an access control system 610. The access control system is used to determine if the user 100 should be granted access to a restricted function 606.

A two-dimensional (2D) verification image 600 is captured and inputted into the verification system 610. It first passes to an anti-spoofing module 602, which determines if the image 600 is of a real human or of a spoofing entity. The output of the anti-spoofing module 602 is fed into the access controller 604. The access controller 604 can then determine whether or not to grant the user of the computer device 102 access to the restricted function 606 based on the output of the anti-spoofing module.

The access control system 610 can be implemented at the hardware level in a variety of ways. For example, in one case its functionality can be implemented entirely locally at the computer device 102 of FIG. 1. Alternatively, this functionality may be implemented at the backend 116 and, in that case, decisions made at the backend 116 can be communicated to the computer device 102 via the network 114 as necessary to give effect to those decisions. Alternatively, the functionality can be implemented in a distributed fashion, for example with part of it being implemented at the computer device 102 and part being implemented at the backend 116, with communication taking place between those two systems via the network 114 as needed to do so.

The access control system 610 may have additional components to determine if the user should be granted access to the restricted function 606. For example, a face recognition module may be included to determine whether a face in the image 600 matches the face of a known authorised user.

The access control technology disclosed herein can be applied in a variety of contexts using a variety of devices, systems etc.

For example, the anti-spoofing method described above may be used to determine if access to the restricted function 606 is granted to an entity. This method may be used in conjunction with other verification methods, such as facial verification, to determine if the entity is the permitted user of the restricted function. For example, the restricted function may be an electronic payment function. A spoofing attack may be attempted by using a photograph or recording of the permitted user or anther 2D spoofing entity. This photograph or recording may be held up to the camera 106 of user device 102 to generate the image 600 which is input into the access control system 610. This image would pass a facial verification test, as it is an image of the verified user, but the anti-spoofing module 602 of the above system would identify that the image is not of an actual human, but of an image of a human, and thus a spoofing entity, so access to the restricted function 606 would be denied. This additional stage of the access control process increases the difficulty for an attacker to access any restricted functions or information, so increasing the security of user data or restricted functions.

As another example, the invention can also be applied in conjunction with age estimation based on images, for example in order to regulate online purchases of age-restricted goods or services or to regulate access to certain age-restricted content online. Another context is in physical retail outlets with self-service technology. Here the computer device 102 may for example be a self-checkout terminal or a handheld “self-scanning” device which a user uses to scan items they wish to purchase as they select them.

In such contexts, where a user wishes to purchase age-restricted items, they may be prevented from doing so if they do not successfully pass the user verification checks that are disclosed herein, or at least may be prevented from doing so subject to further age verification procedures.

FIG. 3 shows fuller details of the anti-spoofing module 602, which is in the form of a neural network.

The anti-spoofing module 602 comprises an image processing component 308, a feature processing component 500, and an anti-spoofing classifier 504, as shown in FIG. 3. The image processing component 308 and feature processing component 500 are ML processing components having a CNN architecture, the principles of which are described later. The anti-spoofing classifier 504 is also a ML component, and may for example comprise a fully connected softmax layer. The 2D verification image 600 is captured using the image capturing device 106 of user device 102. This image 600 in non-spoofing instances would be of user 100, but may be a spoofing entity, such as a photograph or a video of a user when a spoofing attack occurs.

As will be appreciated, an ML processing component with a CNN architecture is comprised of processing layers, which apply a series of convolution operations and non-linear transformations to data ‘volumes’ within the CNN architecture. The processing at each layer is performed according to model parameters in the form of weights that are learned in training. A schematic block diagram that demonstrates some of the principles of data processing within a CNN is shown in FIG. 9, and described in more detail below.

The image 600 is passed to the image processing component 308, which outputs to feature processing component 500, which, in turn, outputs to the anti-spoofing classifier 500. The final output of the classifier 504 is a classification output 502 classifying the entity for which the image 600 in relation to a set of anti-spoofing classes. In the present example, this is a binary classification in relation to ‘real’ and ‘spoofing’ classes only.

To train the ML processing components to function as above, a two-phase training method is applied.

The image processing component 308 is trained to extract depth features from 2D images in a pre-training phase, and the anti-spoofing classifier 504 is trained to perform anti-spoofing classification in the fine-tuning phase. This is a form of “transfer learning” as it is known in the art. The feature processing component 500 is an optional extension which is trained, together with the anti-spoofing classifier 504 in the fine-tuning phase, to refine the depth features provided by the image processing component 308 for the anti-spoofing classification. In certain contexts, this may improve performance, but is not required in all embodiments.

Pre-Training Phase:

In the pre-training phase, the image processing component 308 is trained using both images of living humans 200 and images of spoofing entities 202, such as photographs or videos of humans. FIGS. 4A and 4B show how the training data may be collected using at least one three-dimensional (3D) image capturing device 204. The 3D image capture device 204 captures depth information that can be used to automatically label an associated 2D image for training. 3D image capture equipment is only required for the purpose of collecting training data. In training, the image processing component 308 learns to approximate the depth output of the 3D image capture device 204 given only a 2D image, with the consequence that 3D image capture equipment is not required when the trained system is in use.

The 3D image capturing device 204 is used to capture image data of both actual humans 200 and spoofing entities 202. The spoofing entities 202 may include static or moving (video) images of people. The image data captured by the 3D image capturing device 204 comprises two-dimensional (2D) image data 206 a, 206 b such as an RGB image, and corresponding image depth data 208 a, 208 b, such as a depth map associating a depth value to each of at least some of the pixels in the 2D image. The 2D image and associated depth data constitutes a 3D image which may, for example, be encoded as an RGBD (Red Green Blue Depth) image, which assigns colour and depth values to each image pixel.

FIG. 4A shows the 3D image capturing device 204 generating 2D image data 206 a and corresponding image depth data 208 a when capturing image data of actual human 200.

FIG. 4B shows the 3D image capturing device 204 generating 2D image data 206 b and corresponding image depth data 208 b when capturing image data of spoofing entity 202. If, for example, the spoofing entity 202 is a still image of the actual human 200, the 2D image data 206 a, 206 b generated by the 3D image capturing device 204 may exhibit relatively subtle differences. However, the image depth data collected 208 a, 208 b will vary significantly between the two sources.

The 3D training images captured may be of the same individuals, such that the spoofing entity 202 is an image of the real human 200. If the image processing component 308 is trained using 3D training images of different individuals for the living humans 200 and spoofing entities 202, the model may learn to map depth information to the identity of the individual. Thus, 3D training images of the same individual in both real human 200 and spoofing entity 202 form are used in the pre-training phase.

The 2D image data 206 a, 206 b may be 2D facial images. However, it will be appreciated that, in some contexts, other parts of the body may be imaged. For example, if the access control system included a module for fingerprint verification, the 2D verification image 600 used may be of a user's hand. Therefore, in order to train the image processing component 308 to estimate the depth in the verification image 600, the 2D image data 206 a, 206 b may be of hands.

FIG. 5 shows an example of captured image depth data 208, with a face 400 overlain. The face 400 corresponds to the face of the human 200 or the spoofing entity 202 as captured by the 3D image capturing device 204. The image depth data 208 will be different in these two cases. For example, when image data for the human 200 is captured, the depth data associated with the eye 402 and the nose 404 will differ, since they are at different depths on the face of human 200. However, the depth data collected for the eye 402 and nose 404 of the spoofing entity 202 will not differ significantly since the spoofing entity 202 is a 2D image.

The image depth data 208 can be captured using any form of 3D image capture technology, such as stereoscopic image capture and processing, IR (infra-red) projection, time-of-flight etc.

FIG. 6 shows a schematic of how the 3D image data can be used to train the image processing component 308. The 2D image 206 comprises three data representation ‘layers’: red 302 (R), green 304 (G), and blue 306 (B). These three layers make up a 3D input ‘volume’ (3D array) U_(i) 300 with dimensions M×N×3, where M and N are the number of rows and columns respectively in a 2D matrix corresponding to each of the data representation layers 302, 304, 306 of the 2D image 206. As will be apparent, although represented as a 3D value, the image is still a 2D image as that term is used herein because it lacks explicit depth information. The depth layer D is not provided as an input to the image processing component 308, but rather is used as a ground-truth training label to which the output of the image processing component 308 is matched (see below).

The input value 300 is inputted into the image processing component 308. The image processing component 308 is used to process the image 206. The output of the image processing component 308 is a feature map 310 of size M×N.

The feature map 310 predicts the depth information of the input 2D image 206. This may be in in the form of depth predictions of each pixel, thus the depth of features captured in the 2D image 206. In other embodiments, the feature map 310 predicts depth information of areas of the captured image 206. For example, the feature map 310 may predict depth information for ‘superpixels’ within the captured 2D image 206, where s superpixel is a set of image pixels that have a similar colour and are spatially close to each other. In other embodiments, the feature map 310 may predict the relative depth information between different locations on the 2D facial image 206. It may, for example, predict the relative depths of arbitrary pixels or areas of the 2D image 206, or it may identify facial features in the image 206, such as the eye 402 and nose 404, and predict the relative depths of these features. Therefore, the feature map 310 is a prediction of the image depth data 208 captured by the 3D image capturing device 204 which can take various forms depending on the context.

The output of the image processing component 308 is the estimated depth of the input 2D image 206, as explained above. This estimated depth is a very useful 3D shape descriptor of the depicted face. There may be some instances in which non-uniform depth data is estimated for the input 2D image 206 b generated of the spoofing entity 202. For example, if the spoofing entity 202 is tilted such that the top of the image is closer to the 3D image capturing device 204 than the bottom, the image depth data 208 b will contain depth information which indicates that the depth of the spoofing entity 202 varies to match its positioning relative to the image capturing device 204. Thus, the image depth data 208 b, and the corresponding feature map 310 of the spoofing entity 202 may still contain varying depth data, even though the spoofing entity 202 is a 2D image. However, the shape of the entity in the 3D space will be significantly different to that corresponding to the real human 200. The aim of the pre-training phase is to train the image processing component 308 to identify these differences.

No manual annotations are required for the input array 300. The image processing component 308 is used to predict the image depth data 208, so the image depth data 208 acts as the ground truth against which the output of the image processing component 308 is assessed.

The image processing component 308 is trained using a large number of training 2D images 206 and corresponding image depth data 208. A training dataset comprising a plurality of these pairs of image data is generated.

A pre-training loss function 312 is used to compare the feature map 310 and the image depth data 208. It is calculated as a function of the feature map 310 and the image depth data 208, and provides a measure of the difference between the feature map 310 and the image depth data 208 (which can be based on relative depth—see below). The loss function is used to tune the image processing parameters of the image processing component 308 to the depth extraction task. As the derivative of the loss function 312 with respect to the parameters approaches zero, the feature map 310 approaches the image depth data 208 collected.

A number of different 2D and 3D structures may be used to train the image processing component 308, and the 2D images 206 a, 206 b generated of the training subjects will contain different depth characteristics for the image processing component 308 to learn from. The difference between 2D images of real and spoofing entities 206 a, 206 b may only be subtle, but by exposing the image processing component 308 to a large number of examples, it can learn to infer depth features from even subtle differences in the different types of image. The subtle differences between the 2D images 206 a and 206 b may not be obvious, hence the use of the trained image processing component 308 is advantageous over simply defining a set of rules for the anti-spoofing module to implement when deciding if the entity is a real human 200 or a spoofing entity 202.

The aim of the training is to adjust the image processing parameters of the image processing component 308 in order to match the outputs 310 across the training examples to the corresponding image depth data 208. To achieve this, the loss function 312 is defined to provide a measure of difference between the outputs across the training dataset and the corresponding image depth data 208 in a given iteration of the training process. The loss function 312 may be defined such that it has a greater value for certain inaccuracies in the feature map 310. Differences between the training data and the output of a CNN result in penalties, with some types of differences resulting in larger penalties than others, as defined by the loss function. Back-propagation is then used by a back-propagation component 314 to adapt the model parameters for the next iteration with the objective of minimising the defined loss function 312 i.e. back-propagation aims to correct things the network has been penalised for. This process is repeated until defined stopping criteria are met. The stopping criteria are chosen to optimise the loss function 312 to a sufficient degree, whilst avoiding overfitting of the system 602 to the training set. Following successful training, the image processing component 308 is able to apply the knowledge it has gained in training to new inputs that it has not encountered during training. The principles of back-propagation based on loss functions are well known per se hence further details are only described herein to the extent that they are considered relevant in the present context. What is novel here is using 3D image data is to train a ML processing component to infer the depth of features in a 2D image.

The loss function 312 may consider the absolute depth values predicted in the feature map 310. Alternatively, it may be concerned only with the relative depths predicted. For example, with reference to FIG. 5, the loss function 312 may only penalise the system if the pixels depicting the nose 404 are behind or at the same depth as those depicting the eye 402 for an image of actual human 200, since the nose 404 pixels should be in front of the eyes 402 when an actual human 200 is used as the entity for which an image is captured. In other embodiments, the absolute depths of each pixel in the feature map 310 may not be penalised by the loss function 312, but the pixels should be at depths which scale to the depths of the corresponding pixels in the depth image data 208.

Where the image processing component 308 is trained based on relative depth estimation, the pre-training loss function 312 may be a three-way problem involving a pair of locations A and B on the 2D images 206. There may be three different labels in this case: dA==dB when the two points have the same depth, dA<dB when point A is closer to the camera than point B, and dA>dB when A is further away from the camera than point B. These labels may be determined for the points A and B on both the 2D image 206 and the image depth data 208, and then compared using the pre-training loss function 312. It is expected that training based on relative depth may help to form the model on depth characteristics that are more relevant to anti-spoofing.

A number of specific examples of pre-training loss functions will now be described. It will be appreciated that these example loss functions are described for the purposes of illustration only and that other forms of pre-training loss function are viable.

Regression Approach

The pre-training phase can be implemented using a straightforward regression approach. In machine learning, regression refers to a class of models which capture relationships between a set of input variables and an output variable. In the context of a regression approach, the pre-training loss function 312 may be referred to as a regression loss. The regression loss 312 may be defined in terms of absolute depth or in terms of relative depth.

In the present context, the image processing CNN 308 is trained to perform regression to predict the depth map 310, with the 2D image data 206 as input and the ground-truth depth map 208 encoding target variables. In this case, the input variables are the coordinates and values of the pixels in the 2D image 206 and each pixel of the output feature map 310 constituting an output variable with the regression loss 312, defined so as to penalise deviation from the corresponding pixel of the ground truth depth map 208 in training. The regression loss 312 is used to minimise the difference between the ground truth depth value and the predicted depth value of each pixel. The loss function for the image is the sum of the loss function for each pixel, and parameters of the network are updated to minimise the total loss function across the training set.

The regression approach may, for example use an “L1” or “L2” loss function in training. L1 loss is the sum of absolute distances from the predicted value of a target variable to the ground truth value across the training instance. L2 loss is the sum of square distances between the predicted and ground truth values. The desired effect of minimising these distances is to train a model that predicts a depth map close in to the “real” (absolute) depth of the scene captured by a 2D input image. The depth of both the ground truth and predicted maps may be normalised. The L1 and L2 loss functions are known per se, and are therefore not described in any further detail.

Ordinal Softmax Depth Loss Function

An alternative approach to predicting depth is to discretize the ground-truth depth map values into a reasonable number of labelled, ordered depth classes, and train a classifier to predict the data class for each pixel of a given 2D input image. The image processing component 308 would in this case produce a predicted depth map of depth class labels. Each class corresponds to a “bin”, i.e. a range of depth values.

Typical multi-class classification methods do not account for any relative ordering of labels. For example, with a simple cross-entropy classification loss, if a pixel is classified into the wrong bin, the loss function for classification is the same irrespective of any concept of ‘distance’ between the predicted label and the ground truth label.

In the present context of depth estimation, this may be undesirable, and instead the loss function 312 may be defined within an “ordinal regression” framework. As described in ‘Deep Ordinal Regression Network for Mononuclear Depth Estimation’ (Fu et al., 2018), incorporated herein by reference in its entirety, ordinal regression can be implemented by defining a set of thresholds to separate each class, and training a set of binary classifiers, one for each threshold, that predict whether a given pixel falls above or below the threshold defining that classifier. The output of each classifier may be the probability that the pixel is above the classifier's threshold.

For a set of K classes, there will be K−1 thresholds and thus K−1 classifiers. If a ground truth pixel's value is below or equal to a threshold value, it may be assigned the classification value 0, and if its value is above a threshold, it may be assigned the classification value 1. A given pixel of the ground truth depth map could thus be represented as a vector of length K−1 (the number of thresholds), where the value of the k^(th) entry is 0 if the pixel value is below or equal to the threshold k and l if it is above the threshold k.

The ordinal regression model may calculate a cross-entropy loss for each of the binary classifiers. For classifiers with thresholds equal to or above the correct label, the ground truth value for that classifier is 0 and the cross-entropy term is log(1−P^(k)). For classifiers with a threshold below the correct label, the ground truth value is 1 and the cross-entropy is log(P^(k)).

The resulting loss function 312 for a single pixel of the image is:

${\sum\limits_{k = 0}^{l - 1}{\log \left( p^{k} \right)}} + {\sum\limits_{k = l}^{K - 1}{\log \left( {1 - p^{k}} \right)}}$

The parameters (weights) of the image processing CNN 308 can be adjusted with the goal of minimising the above loss function across all pixels of all images of the training set. This can be achieved using gradient methods to update the weights, computing the gradient of the loss function 312 with respect to the network weights via backpropagation as described above.

By way of example, FIG. 10 shows an example of ordinal regression applied with at least four depth bins 1002, using at least three threshold classifiers 1004 defined with respect to thresholds T1, T2 and T3 respectively which respectively define the boundaries between bin 1 and bin 2, bin 2 and bin 3, and bin 3 and bin 4. It will be appreciated that this is merely an example and the present ordinal regression techniques can be applied with different numbers of depth bins.

Fine-Tuning Phase:

Fine-tuning of the neural network is shown in FIG. 7. Again, the 3D array 300 derived from the captured 2D image 206 is used as the input of the image processing component 308. The image processing component 308 may have had one or more of the final layers removed or all of the processing layers learned in pre-training may be retrained. Where the final layer(s) is removed, the classification is performed using an output of at least one “hidden” (intermediate) layer of the image processing component 308, i.e. a processing layer(s) before the removed final layer(s). In that case is it (intermediate) depth information extracted by the hidden layer(s) that is used as a basis for classification. The image processing component 308 passes its output to the feature processing component 500 which is used for feature refinement. The output of feature processing component 500 is passed to the anti-spoofing classifier 504, which is a fully connected softmax layer. This outputs a classification output 502 which classifies the input array 300 as either a human or a spoofing entity (or, more generally, in relation to at least ‘real’ and ‘spoofing’ classes).

The training data used in this stage of the training process may be the same as the data used to train the image processing component 308. Alternatively, a different dataset may be used. If a different dataset is used, only 2D images 206 are required, so a 2D image capturing device could be used to collect the data, but both real humans 200 and spoofing entities 202 need to be captured so that the anti-spoofing classifier 500 can be trained to identify both.

The training data is labelled with label 506. This is the ground truth anti-spoofing classification. The label 506 labels the input array 300 as either an image of an actual human 200 or of a spoofing entity 202. Thus, the label 506 is also a binary value. The labels 506 of the input arrays 300 in the training dataset are applied manually, however it is relatively easy for a human to apply these as they are straightforward classifying classes. The number of training images in the training dataset used for fine-tuning may be much smaller than the number required for pre-training of the image processing component 308.

The depth information inferred by the image processing component 308 of features captured in the 2D image 206 a, 206 b can be used by the anti-spoofing classifier 504 to determine if the entity in the captured image is a real human 200 or a spoofing entity 202.

The feature processing component 500 contains convolutional and fully connected layers whose parameters will be learned at the fine-tuning phase. These layers will learn to extract an even better 3D shape representation than that extracted by the image processing component 308 from the estimated depth as predicted by the image processing component 308. The prediction of the feature processing component 500 is then passed to the anti-spoofing classifier 504 for distinguishing between real and spoofing samples.

To train the feature processing component 500 and the anti-spoofing classifier 504, a fine-tuning loss function 508 is used. This is a different loss function used to that used to train the image processing component 308. The fine-tuning loss function 508 is a function of the classification output 502 and the label 506 of the training data, and is a measure of the difference between the label 506 and the classification output 502.

Back-propagation is then used by a back-propagation component 510 to adapt the feature processing parameters of the feature processing component 500 and the classification parameters of the classification component 504 for the next iteration with the objective of minimising the defined fine-tuning loss function 508. This process is repeated until defined stopping criteria are met. The stopping criteria are chosen to optimise the fine-tuning loss function 508 to a sufficient degree, whilst avoiding overfitting of the system 602 to the training set. The weights of the image processing component 308 are frozen during pre-training. Alternatively, rather than completely freezing the weights, small updates to those parameters may be permitted based on the classification error.

Following successful training, the feature processing component 500 and anti-spoofing classifier 504 are able to apply the knowledge it they have gained in training to new inputs that the neural network has not encountered during training.

FIG. 8 shows further details of the anti-spoofing classifier 504 in one example. Two classes are show which correspond to spoofing and human classes. In the example of FIG. 8, the anti-spoofing classifier 504 takes the form of a “fully connected” neural network processing layer comprising two neurons (nodes) which are represented as circles numbered 1 and 2. The anti-spoofing classifier 504 is shown to comprise a fully connected layer with a softmax activation. Each of the nodes 1 and 2 operates directly on the feature refinement vector 700, the output of feature processing component 500, which is represented using mathematical notation as h, and computes a weighted sum of the components of h:

$\sum\limits_{i}{w_{n,i}h_{i}}$

The set of weights w_(n,i) used by node n (corresponding to age class n) are learned during training so as to weight the corresponding features h_(i) according to their relevance to the anti-spoofing class in question. The weights across the two neurons constitute the classification parameters of the anti-spoofing classifier 504 in the present example. Softmax normalisation is then applied across the outputs of the neurons 1 and 2 in order to compute normalised class probabilities for each of those classes. The processing layer is fully connected in that the weighted sum computed by each node n is defined over the entire refined feature vector 700, and based on a set of weights {w_(n,i)} unique to that node n, which emphasise features most relevant to anti-spoofing class n. For example, n=1 may correspond to real humans and n=2 to spoofing entities.

Although FIG. 8 shows only a single fully-connected layer, the anti-spoofing classifier 504 can have a more complex structure. For example, it may comprise multiple fully-connected layers at which one or more intermediate non-linear processing operations are performed (before the final softmax normalization).

Controlled Illumination

In some embodiments, the user device 102 may control the lighting of the entity by using, for example, the display or the camera flash. It may, for example, produce a colour or flash(es) of light and detect the effects on the entity. It is expected that the anti-spoofing module 602 may then detect the effects of the light on the entity in the captured image 600. It may detect shadows or glare for example on the entity, for example detecting for unexpected shadows produced by lighting in an environment in which a photograph was taken, or unexpected glare due to lights on a reflective surface such as a screen or photographic paper. However, ultimately the image processing component 308 makes its own ‘decision’ about which features to detect based on the examples it encounters in training.

In order for the anti-spoofing module 602 to be able to use such information to determine if the entity is real or spoofing, the image processing component 308 must be trained using training data which includes images 206 a, 206 b of both real humans 200 and spoofing entities 202 which have different lighting effects applied to them. The image processing component 308 can be trained using this dataset as described above.

Data Processing

FIG. 9 shows a schematic block diagram that demonstrates some of the principles of data processing within a CNN. Such data processing is applied in the image and feature processing components 308 and 500.

A CNN is formed of processing layers and the inputs to and outputs of the processing layers of a CNN are referred to as volumes. Each volume is effectively formed of a stack of two-dimensional arrays each of which may be referred to as a “feature map”.

By way of example FIG. 9 shows a sequence of five such volumes 902, 904, 906, 908 and 910 that may for example be generated through a series of convolution operations and non-linear transformations, and potentially other operations such as pooling, as is known in the art. For reference, two feature maps within the first volume 902 are labelled 902 a and 902 b respectively, and two feature maps within the fifth volume 910 are labelled 910 a and 910 b respectively. Herein (x,y) coordinates refer to locations within a feature map or image as applicable. The z dimension corresponds to the “depth” of the feature map with the applicable volume. A color image (e.g. RGB) may be represented as an input volume of depth of three corresponding to the three color channels, i.e. the value at (x,y,z) is the value of color channel z at location (x,y). A volume generated at a processing layer within a CNN has a depth corresponding to a number of “filters” applied at that layer, where each filter corresponds to a particular feature the CNN learns to recognize.

A CNN differs from a classical neural network architecture in that it has processing layers that are not fully connected. Rather, processing layers are provided that are only partially connected to other processing layer(s). In particular, each node in a convolution layer is connected to only a localized 3D region of the processing layer(s) from which it receives inputs and over which that node performs a convolution with respect to a filter. The nodes to which that node is particularly connected are said to be within a “receptive field” of that filter. The filter is defined by a set of filter weights and the convolution at each node is a weighted sum (weighted according to the filter weights) of the outputs of the nodes within the receptive field of the filter. The localized partial connections from one layer to the next respect (x, y) positions of values within their respective volumes, such that (x, y) position information is at least to some extent preserved within the CNN as data passes through the network. By way of example, FIG. 9 shows receptive fields 912, 914, 916 and 918 at example locations within the volumes 912, 914, 916 and 918 respectively. The values within the receptive field are convolved with the applicable filter in order to generate a value in the relevant location in the next output volume.

Each feature map is determined by convolving a given filter over an input volume. The depth of each convolution layer is thus equal to the number of filters applied at that layer. The input volume itself can have any depth, including one. For example, a colour image 600 may be provided to the image processing component 308 as an input volume of depth three (i.e. as a stack of three 2D arrays, one for each color channel); the input volume provided to the feature processing component 500 may be a feature map of depth one, i.e. a single 2D array of the inferred pixel depths as found by the image processing component 308.

Using an image as an example, when a convolution is applied to the image directly, each filter operates as a low-level structure detector, in that “activations” (i.e. relatively large output values) occur when certain structure is formed by the pixels within the filter's receptive field (that is, structure which matches a particular filter). However, when convolution is applied to a volume that is itself the result of convolution earlier in the network, each convolution is performed across a set of feature maps for different features, therefore activations further into the network occur when particular combinations of lower level features are present within the receptive field. Thus, with each successive convolution, the network is detecting the presence of increasingly high level structural features corresponding to particular combinations of features from the previous convolution. Hence, in the early layers the network is effectively performing lower level structure detection but gradually moves towards higher level semantic understanding of structure in the deeper layers. There are, in general terms, the broad principles according to which the image processing component 308 learns to extract relevant depth characteristics from image data, and by which the feature processing component 500 refines these features where applicable.

The filter weights are learned during training, which is how the network learns what structure to look for. As is known in the art, convolution can be used in conjunction with other operations. For example, pooling (a form of dimensionality reduction) and non-linear transformations (such as ReLu, softmax, sigmoid etc.) are typical operations that are used in conjunction with convolution within a CNN

As processing occurs in a CNN, generally (x,y) dimensionality reduction will occur. However, the feature processing component 500 needs to provides an output whose dimensionality matches the depth map D to which it is compared. Therefore, the image processing component 308 includes one or more layers for upsampling. This allows for image segmentation, in which every pixel of the image has a label associated with it. The output if the image processing component 308 thus is a feature map 310 of size M×N, which is the same height and width as the depth map D.

The principles of upsampling in CNNs are known for example from existing segmentation networks, and are therefore not described herein in any further detail.

Global Versus Local Perception

With the CNN architecture and training described above, the image processing component 308 will take a “global” approach to the estimation of depth that is used for the purpose of the subsequent anti-spoofing classification. Typically, a combination of filtering and down-sampling will be applied at successive layers within the image processing CNN 308 and/or the feature processing component 500 such that structure within increasingly large areas of the original image 206 will be taken into account. Moreover, the classification result provided by the classifier 504 is a global classification of the image 600 as a whole. For ease of readability, the image processing component 308 may be referred to in the following description as the global depth estimator 308, and the classifier 504 may be referred to as a global anti-spoofing classifier.

FIG. 12 shows the image processing CNN 308 to have an “hourglass shape”. Although highly schematic, this represents the general concept that, in the initial layers of the image processing CNN 308, the perceptive field over which each filter is defined corresponds to increasingly large areas of the original training image 206. In the later layers of the image processing CNN 308, some form of up-sampling is applied to ultimately bring the dimensionality of the feature map 310 up to match that of the ground truth depth map 208 in FIG. 6. The feature processing component 500 may also use relatively large perceptive fields and/or some form of down sampling to achieve a global perspective. This is beneficial as it allows more global information within the original 2D training image 206 (e.g. 206 a and 206 b) to be taken into account by the image processing CNN 308 for the purpose of estimating the depth values across the image 206.

In order to augment this global perspective, as shown at the bottom half of FIG. 12 at least one localised ‘patch-based’ image processing component may be provided, which operates in conjunction with the image processing component 308 to provide a more localised analysis of the 2D training image 206. Two such patch-based image processing components are shown in FIG. 12, denoted by reference numerals 1100 a and 1100 b respectively, each of which feeds into a respective patch-based anti-spoofing classifier 1102 a, 1102 b. The first patch-based image-processing component and classifier 1100 a, 1102 a constitute a first patch-based anti-spoofing component, and the second patch-based image-processing component and classifier 1100 b, 1102 b constitute a second patch-based anti-spoofing component. Each patch-based anti-spoofing component operates independently but with broadly the same architecture. That architecture is described below with reference to FIG. 11, which shows a patch-based image processing component 1100 (e.g. 1100 a or 1100 b) coupled to a patch-based anti-spoofing classifier (e.g. 1100 b or 1102 b).

The purpose of the localised image processing component 1100 at inference is to separately classify individual patches within the original 2D image 600 in relation to a set of classes that is useful in the context of anti-spoofing. These may be the same as or different than the anti-spoofing classes over which the outputs of the global classifier 500 are defined (e.g. both bay use the same simple binary scheme consisting of a single “real” class and a single “spoofing” class, or one or both may use more complex multi-class schemes, e.g. with multiple spoofing classes for different types of attack). In the first example described below, the localised image processing component 1100 is configured to classify each of a plurality of image patches in relation to real/spoofing classes. What this means in practice, is that, once the localised image processing component 1100 has been trained, and a 2D image is provided to it at inference, it may be that some patches within that image are classified as real whereas other patches within the same image are classified as not real, i.e. spoofing. Although, ultimately, an image will either be of a real person or a spoofing entity, giving the localised image processing component 1100 the flexibility to assign different real/spoofing classification values to different patches within the image takes into account the fact that certain regions within the image may be highly similar or indistinguishable between real and spoofing images, and that the differences between real and spoofing images may only be readily identifiable in certain other regions within the image 600.

An issue that can arise when training the global anti-spoofing classifier 504 and the feature processing component 500, in the fine-tuning phase, is that the system may start to rely on identity of users for classification—a form of overfitting. This can be overcome by including examples of both real and spoofing images for the same users (i.e. for each of those users, both a real image of that user and a spoofed image of that user is included). However, this does impose some restriction on the training set.

A focus on local patches prevents the model from relying on the identity of either the real person or the person in the spoof image to classify the attempt. This relaxes the requirement of having both genuine and spoof training samples from the same individuals in the training dataset, meaning greater flexibility for curating the training set.

Multiple patch-based image processing components of this nature may be provided and trained to detect different types of spoofing attacks. For example, a first such component could be trained to detect a “mask attack” in which a user prints a face of another user onto a piece of paper, and forms of a cut out in the region of the nose. The user can then use this as a simple mask, with his or her own nose protruding through the cut out. When an image is captured of the user with the mask, the region in which the user's real nose is captured will, at a local level at least, be indistinguishable from a non-spoofing image because what is captured in the image is a real 3D human nose. However, other facial structure with the image will generally appear significantly less realistic, in particular the region of more complex facial structure around the eyes which is much harder to spoof.

A second patch-based component may be trained to detect other spoofing attempts such as photograph (print) and video (replay) attacks, focusing on colour distortion and local texture features to detect a spoofing attempt. A system that combines both of the above-mentioned cases with a global anti-spoofing component is described below and shown in FIG. 12.

The combination of a global perspective on depth provided by the global depth extractor 308 together with the localised interpretation by the localised image processing component 1100 provides an effective way of detecting mask attacks and other similar attacks. In the case of a mask attack, it may be expected that the localised image component will classify image patches of the image 600 around the nose as real but will classify other image patches around the eyes as spoofing. Together with an indication in the estimated depth map that the region around the eyes does not exhibit the expected 3D structure of the region around the eyes, those two pieces of information provide compelling evidence that the image in question is a spoofing image and not that of an actual human face presented to the camera.

The localised image processing component 1100 can be implemented with a “patch based CNN architecture”, as will now be described.

Patch-Based Anti-Spoofing Network

A highly schematic representation of a patch-based image processing component 1100 is shown in FIG. 11. A 2D image 600 is passed as input to the localised image processing component 1100, comprising a CNN. The output volume, a stack of 2D arrays, of the localised image processing component, is then passed to a patch-based classifier 1102 which is trained to detect local texture and colour features that may be indicators of spoof videos or photographs and output a set of classification values for each of a set of image patches extracted by the CNN, where example image patches 1106 and 1108 of the input image 600 are shown in FIG. 11. Note, the patch-based classifier 1102 does not classify the image as a whole, but rather classifies each image patch individually. The patch-based classifier 1102 may take the form of a final convolutional layer. The classification value represents the likelihood of the patch belonging to a ‘real’ or ‘spoofing’ image. These classification values can be combined over all patches to output a classification value for the entire image. The CNN 1100 and the patch-based classifier 1102 constitute a localized anti-spoofing component, and may be trained simultaneously in an end-to-end fashion.

For print and replay attack detection, the localized anti-spoofing component is trained on images of live humans, as well as spoofing entities, including print photographs and videos, generated by a 2D image capturing device. The input volume is the 3D array 300 obtained from the captured 2D image 206 shown in FIG. 6.

For mask attack detection, this component is trained specifically on images of mask and cut-out attacks, which are described earlier. In this case, the architecture remains identical, but the training data consists of examples of mask and cut out attacks and real humans.

FIG. 12 shows a system with two such localized image processing components 1100 a and 1100 b, where the components 1100 a and 1100 b trained on mask attacks and print/replay attacks, respectively. Similarly, components 1102 a and 1102 b are patch-based classifiers trained on mask attacks and print/replay attacks, respectively.

The patch-based image processing component 1100 in FIG. 11 is a CNN comprising multiple convolutional layers, each of which consists of a stack of two-dimensional arrays. FIG. 9a shows a high level overview of data processing by a shallow CNN. As described earlier, the input at each layer of a CNN consists of ‘volumes’, i.e. stacks of 2D arrays. The input volume 902 may have a stack of depth 3 representing each of the colour channels R, G, B. Subsequent volumes 904, 906, have stack depth dependent on the number of filters applied at the previous convolutional layer. FIG. 9a shows a high-level example of a CNN which consists of a small number of layers and thus learns a low-level representation of the input images with a focus on basic structural elements. It will be appreciated that the patch anti-spoofing network may consist of a different number of layers than what is illustrated in FIG. 9 a.

The receptive fields 912, 914 in this network are small relative to the image size, in order to detect low-level structures within images. The filters also have a small stride length of e.g. 2, meaning that each input patch is shifted by 2 pixels compared with the nearest patch in any direction. The resulting convolution, or any non-linear transformation that may be applied to the convolution, is large for a given filter if the structure in its receptive field matches the structure the filter has been trained to detect. The CNN may utilise padding to control the size of output arrays.

As shown in FIG. 12, after being processed by CNNs 1100 a and 1100 b, classification functions 1102 a and 1102 b are applied to the respective output volumes to map them to 2-dimensional arrays of classification values, each representing the likelihood of the corresponding patch of the input image belonging to a real human rather than a mask attack or a spoof image.

The output of these classifiers may be combined with the output of the global anti-spoofing classifier 504 in a combined classification component 1104 to predict a binary label of ‘spoof’ or ‘real’ for the input image, considering both global, local and mask-specific features. This final anti-spoofing result is a binary decision, which determines whether or not to grant access to the restricted function 606. This final decision takes into account both the global information from the global classifier 500, but also the localized information from the patch-based classifier(s) 1102 (1102 a and/or 1102 b).

As an alternative to the architecture of FIG. 12, a single patch-based anti-spoofing component could be trained to perform multi-classification, with at least three classes, e.g. real, cut-out/mask attack and replay/print attack (the latter two being, conceptually, sub-classes of the broader spoofing class, corresponding to specific types of spoofing attack).

Anti-Spoofing Heatmap

Each value output by the CNN 1100 may be traced back through the network as shown in FIG. 9a , where a value of one array of the final output layer 916 a is mapped to a receptive field 912 of the original input volume 902. This allows mapping of final classification values back to patches of the original image. However, these patches are overlapping which makes it difficult to interpret which local features contribute most to the classification output. The array of classification values may instead be converted to a heatmap of scores, wherein each bin of the heatmap corresponds to a distinct subset of pixels in the input image 600. The patches and their overlap is defined by the side of the image 600 and the configuration of the convolutional layers—including the perceptive field and stride applied at each filtering layer.

FIG. 13 shows an example of a heatmap 1300 overlaid on an input image, with a heatmap pixel 1302 highlighted. A pixel of the heatmap does not necessarily correspond with a single image pixel. A heat map pixel could be a ‘superpixel’ corresponding to a region of multiple pixels in the input image. Each individual pixel within the same superpixel is assigned the same classification value (anti-spoofing score). The size of a superpixel may be determined by the stride of the convolutional filters, such that a larger stride at each convolutional layer corresponds to a larger region of the input image represented by each pixel of the heatmap.

The score S_(p) for each pixel p of the heatmap may be computed as an average of the scores of each patch m in the input image to which the pixel p belongs:

$S_{p} = \frac{\Sigma_{m \in M_{p}}S_{m}}{M_{p}}$

where M_(p) is the subset of image patches to which the pixel p belongs, m∈M_(p) is a patch in M_(p) and S_(m) is the anti-spoofing score assigned to patch m.

The resulting heatmap may or may not be used for detecting spoof attacks. The heatmap highlights areas of the input image 600 that signal a particularly high probability that the image is a spoof, for example, as described earlier, the areas around the eyes may be particularly indicative of a mask attack. This format is helpful for a human analyst to interpret the areas of focus for the network, where scores for overlapping patches are less representative of individual facial features. Heatmaps may be used to identify overfitting of the training data, as the network may learn specific facial features of positive training images and apply these rules in testing even though the given feature may not relate to the spoofing attempt.

Use Cases

The above system for detecting spoofing attacks may be used in a number of different user authentication systems. For example, the access control system 610 may contain one or more modules for biometric authentication, such as fingerprint or facial recognition. These modules assess if the biometrics supplied by the user of the device match those of the verified user. If the user-supplied biometrics do match those of the verified user, and the image captured is of an actual human, as determined by the anti-spoofing module 602, the user is granted access to the restricted function 606.

The anti-spoofing module 602 may be used in automated age estimation. A user may be required to prove their age, for example when purchasing alcohol or trying to access age restricted material online. Other example use-cases include age estimation at a self-checkout terminal, gambling terminal, vending machine or other age-restricted terminal, to avoid or reduce the need for manual age verification to authorize the use of such terminals. A user may provide proof of his age using age estimation techniques, where, for example, the user's age is estimated using facial and speech characteristics. The anti-spoofing module 602 may be used alongside the modules required for age estimation to verify that any image data supplied is of an actual human. This reduces the ability of users to spoof the age estimation system by using images of people who meet the age requirements of the age restricted content or activity.

It will be appreciated that, whilst specific embodiments of the invention have been described, these are not exhaustive. The scope of the invention is not defined by the described embodiment but only by the appendant claims. 

1-45. (canceled)
 46. A method of configuring an anti-spoofing system to detect if a spoofing attack has been attempted, the method comprising: training an image processing component of the anti-spoofing system to process 2D verification images according to a set of image processing parameters, in order to extract depth information from the 2D verification images; and wherein the configured anti-spoofing system comprises an anti-spoofing component which uses an output from the processing of a 2D verification image by the image processing component to determine whether an entity captured in that image corresponds to an actual human or a spoofing entity; wherein the image processing parameters are learned during the training from a training set of captured 3D training images of both actual humans and spoofing entities, each 3D training image captured using 3D image capture equipment and comprising 2D image data and corresponding depth data, by: processing the 2D image data of each 3D training image according to the image processing parameters, so as to compute an image processing output for comparison with the corresponding depth data of that 3D image; and adapting the image processing parameters in order to match the image processing outputs to the corresponding depth data, thereby training the image processing component to extract depth information from 2D verification images captured using a 2D image capture device.
 47. The method of claim 46, comprising configuring a classification component of the anti-spoofing component to classify each of the 2D verification images, in relation to real and spoofing classes, respectively, to 2D verification images of actual humans and 2D verification images of spoofing entities, using the output from the processing of that image by the image processing component, for use in making said determination.
 48. The method of claim 47, wherein the classification component of the anti-spoofing system classifies images according to a set of classification parameters, which are learned from example 2D verification images labelled with anti-spoofing classification labels, wherein the example 2D verification images are 2D components of the 3D training images.
 49. The method of claim 48, wherein the image processing component is trained in a pre-training phase, and the classification component is subsequently trained to learn the classification parameters in a fine-tuning phase, wherein the learned image processing parameters are frozen in the fine-tuning phase and the classification component comprises at least one neural network processing layer.
 50. The method of claim 49, wherein the classification component of the anti-spoofing system classifies images according to a set of classification parameters, which are learned from example 2D verification images labelled with anti-spoofing classification labels, wherein the example 2D verification images are 2D components of the 3D training images, and wherein the anti-spoofing system comprises a feature processing component which refines the output prior to classification based on a set of learned feature processing parameters, wherein the feature processing parameters are learned in the fine-tuning phase simultaneously with the classification parameters.
 51. The method of claim 47, wherein the anti-spoofing system further comprises at least one patch-based anti-spoofing classifier, which classifies each of multiple image patches within an inputted 2D image in relation to real and spoofing classes, wherein the patch-based anti-spoofing classifier is trained such that different image patches of the inputted 2D image may be differently classified in relation to those classes, wherein the patch-based anti-spoofing classifier is trained using at least one of: the 2D image data of the 3D training images, and a separate set of 2D verification training images, and wherein the anti-spoofing system uses the combination of said classification by the classification component of the 2D verification image and the classifications of the patches within that 2D verification image by the patch-based anti-spoofing classifier in order to determine whether the entity is an actual human or a spoofing entity.
 52. The method of claim 46, wherein the 2D verification image is a facial image.
 53. The method of claim 46, wherein the image processing parameters are adapted to match the image processing outputs to the corresponding depth data based on a loss function, which provides a measure of difference between each of the image processing outputs and the corresponding depth data.
 54. The method of claim 53, wherein the loss function is a relative depth loss function which provides a measure of difference between a relative depth order of different image points predicted in each image processing output and a relative depth of those features in the corresponding depth data, without penalizing discrepancies in the absolute depth of those features when their relative depth has been predicted correctly.
 55. The method of claim 46, comprises convolutional neural network (CNN) processing layers.
 56. The method of claim 46, wherein the anti-spoofing system comprises a feature processing component which refines the output prior to classification based on a set of learned feature processing parameters.
 57. The method of claim 46, wherein the training is based on a regression loss function, which penalises deviations between the image processing outputs and the corresponding depth data, each image processing output in the form of an estimated depth map and the depth data of each 3D training image being in the form of ground truth depth map.
 58. The method of claim 46, wherein the training is based on an ordinal regression loss function, defined with respect to a set of depth classes in the manner that encodes a relative ordering of the depth classes, wherein the depth data of each 3D training image is used to derive ground truth depth classification data for each image, to which the image processing outputs are matched in training.
 59. The method of claim 46, wherein the anti-spoofing system further comprises at least one patch-based anti-spoofing classifier, which classifies each of multiple image patches within an inputted 2D image in relation to real and spoofing classes, wherein the patch-based anti-spoofing classifier is trained such that different image patches of the inputted 2D image may be differently classified in relation to those classes, wherein the patch-based anti-spoofing classifier is trained using at least one of: the 2D image data of the 3D training images, and a separate set of 2D verification training images.
 60. A computer system for performing anti-spoofing based on 2D verification images, the computer system comprising: an image input configured to receive a 2D verification image captured by a 2D image capture device; a machine learning image processing component configured to extract depth information from the 2D verification image according to a set of learned image processing parameters, the image processing parameters having been learned from 3D training images captured using 3D image capture equipment; and an anti-spoofing component configured to use the extracted depth information to determine whether an entity captured in the 2D verification image corresponds to an actual human or a spoofing entity.
 61. The computer system of claim 60, wherein the system comprises one or more hardware processors configured to implement the machine learning image processing component and the anti-spoofing component.
 62. The computer system of claim 60, wherein the anti-spoofing component comprises a classification component configured to use the extracted depth information to classify the 2D verification image in relation to real and spoofing classes corresponding, respectively, to 2D verification images of actual humans and 2D verification images of spoofing entities for making said determination.
 63. The computer system of claim 60, comprising an illumination controller configured to generate a control output to cause an illumination component to illuminate a field of view of the image capture device whilst the 2D verification image is captured, wherein the depth information is extracted based on resulting illumination effects captured in the 2D verification image, wherein the illumination effects comprise at least one of glare and shadow effects.
 64. The computer system of claim 60, comprising an access controller configured to regulate access to a restricted function based said determination by the anti-spoofing component.
 65. The computer system of claim 60, wherein the anti-spoofing component further comprises at least one patch-based anti-spoofing classifier, which separately classifies each of multiple image patches within the 2D verification image in relation to real and spoofing classes, whereby different image patches may be classified differently in relation to those classes, and wherein the anti-spoofing component uses the extracted depth information together with the classifications of the multiple image patches by the patch-based anti-spoofing classifier to determine whether the entity is an actual human or a spoofing entity. 